package org.lwd.datalink.core.runtime;

import lombok.extern.slf4j.Slf4j;
import org.lwd.datalink.core.runtime.rest.RestServer;

/**
 * Datalink Worker 中央控制器
 */
@Slf4j
public class WorkerController {

    private final Keeper keeper;
    private final RestServer rest;

    public WorkerController(Keeper keeper, RestServer rest) {
        this.keeper = keeper;
        this.rest = rest;
    }

    public void startup() {
        keeper.start();
        rest.start(keeper);

        log.info("Worker Controller started.");
    }

    public void shutdown() {
        rest.stop();
        keeper.stop();

        log.info("Worker Controller stopped.");
    }
}
